#include "../../include/server.hpp"
#include <unordered_map>
#include <vector>
using namespace std;

void protocol(const ptrConnection& pcon, Buffer& buf)
{
    // 这里需要将读取的数据清空
    buf.readerIdxGo(buf.getReadAbleSize());
    string msg = "hello, I'm server";
    pcon->send(msg.c_str(), msg.size());
    // pcon->close();
}

int main()
{
    std::shared_ptr<tcpServer> svr = make_shared<tcpServer>(8080, 2);
    svr->setProtocolCb(protocol);
    svr->setInactiveFree(5);
    svr->init();
    svr->start();
}